package drupal

// Build Drupal Node Map
// format = basic_html,restricted_html,full_html
func NewNode(title, body, format, resource, termId string) map[string]interface{} {
	return map[string]interface{}{
		"data": map[string]interface{}{
			"type": "node--article",
			"attributes": map[string]interface{}{
				"title": title,
				"body": map[string]interface{}{
					"value":  body,
					"format": format,
				},
				// 来源
				"field_resource": map[string]string{
					"uri":   resource,
					"title": resource,
				},
			},
			// 关系
			"relationships": map[string]interface{}{
				"field_tags": map[string]interface{}{
					"data": map[string]interface{}{
						"type": "taxonomy_term--tags",
						"id":   termId,
					},
				},
			},
		},
	}
}
